<?php
/**
 * mt-erp functions and definitions
 * 
 * @package WordPress
 * @subpackage mt-erp
 * @copyright nuarharuha <nhnoah+mt-erp@gmail.com>
 * ================================================================
 * SVN revision information:
 * @version $Revision: 4 $:
 * @author  $Author: nhnoah@gmail.com $:
 * @date    $Date: 2012-04-17 06:42:39 +0000 (Tue, 17 Apr 2012) $:
 * ================================================================
 * @since 0.1
 */

// Directory Separator Constant
if (!defined('DIRSEP')) define('DIRSEP',DIRECTORY_SEPARATOR);

	// common theme constant
	$wpi_constant = TEMPLATEPATH.DIRSEP.'lib'.DIRSEP.'defconstant.php';
	
	if (file_exists($wpi_constant))
    {
        /**
		require $wpi_constant;
		require WPI_LIB.'theme.php';
		
		load_theme_textdomain(WPI_META);		
		$Wpi = new Wpi();
		unset($wpi_constant);
        */
	}
     
/**
 * remove the annoying admin bar 
 */

remove_action('init','_wp_admin_bar_init');

function __e($s){ echo $s; }

function mt_get_public_uri($filename,$type = 'css'){    
    return get_template_directory_uri().'/public/'.$type.'/'.$filename;
}

function mt_public_uri($filename, $type = 'css'){
    echo mt_get_public_uri($filename,$type);
}

function mt_posted_on(){
	printf( __( '<span class="%1$s">Posted on</span> %2$s <span class="meta-sep">by</span> %3$s', 'twentyten' ),
		'meta-prep meta-prep-author',
		sprintf( '<a href="%1$s" title="%2$s" rel="bookmark"><span class="entry-date">%3$s</span></a>',
			get_permalink(),
			esc_attr( get_the_time() ),
			get_the_date()
		),
		sprintf( '<span class="author vcard"><a class="url fn n" href="%1$s" title="%2$s">%3$s</a></span>',
			get_author_posts_url( get_the_author_meta( 'ID' ) ),
			esc_attr( sprintf( __( 'View all posts by %s', 'twentyten' ), get_the_author() ) ),
			get_the_author()
		)
	);    
}

function mt_page_url($pagename)
{
    echo get_site_url(null,$pagename).'/';
}

function mt_get_home_url(){
    return esc_url( home_url( '/' ) );
}

function mt_home_url(){
    echo mt_get_home_url();
}


/**
 * Initialize sidebar 
 * 
 */

add_action( 'widgets_init', 'mt_register_sidebars' );

function mt_register_sidebars() {

	register_sidebar(
		array(
			'id' => 'home',
			'name' => __( 'Home' ),
			'description' => __( 'Frontpage sidebar for aside content.' ),
			'before_widget' => '<div id="%1$s" class="widget %2$s">',
			'after_widget' => '</div>',
			'before_title' => '<h3 class="widget-title">',
			'after_title' => '</h3>'
		)
	);
} 
?>